<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <button class="add">添加</button>
  <ul>
    <li>我是li001</li>
    <li>我是li002</li>
    <li>我是li003</li>
  </ul>

  <script>
    let addBtn = document.querySelector(".add");

    let ul = document.querySelector("ul");

    let queryLis = document.querySelectorAll("li");
    let getLis = document.getElementsByTagName("li");//自带刷新增加li

    addBtn.addEventListener("click", () => {
      ul.appendChild(document.createElement("li"));

      console.log(queryLis);
      console.log(getLis);
    })
  </script>
</body>

</html>